package presentacion;

import accesoDatos.GestorAsignacion;
import accesoDatos.GestorEspera;
import accesoDatos.GestorEstudiante;
import accesoDatos.GestorMaquina;
import java.awt.Image;

/**
 *
 * @author Manuelita
 */
public class MenuPrincipal extends javax.swing.JFrame {
    private GestorEstudiante gestorEstudiante;
    private GestorMaquina gestorMaquina;
    private GestorAsignacion gestorAsignacion;
    private GestorEspera gestorEspera;

    /** Creates new form MenuPrincipal */
    public MenuPrincipal(int tipoUsuario) {
        initComponents();
        setExtendedState(MAXIMIZED_BOTH);
        this.mensajesAyuda();
        this.gestorEstudiante = new GestorEstudiante();
        this.gestorMaquina = new GestorMaquina();
        this.gestorAsignacion = new GestorAsignacion();
        this.gestorEspera = new GestorEspera();
        if(tipoUsuario == 2)
            this.mn_Reportes.setEnabled(false);
    }

    private void mensajesAyuda(){
        this.bt_Control.setToolTipText("Ir al Modulo de Control del Sistema");
        this.bt_ListaEspera.setToolTipText("Ir al modulo de Lista de Espera");
        this.bt_ReporteUso.setToolTipText("Acceder a los Reporte de Uso");
        this.bt_CerrarSesion.setToolTipText("Cerrar la Sesion");
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jToolBar1 = new javax.swing.JToolBar();
        bt_Control = new javax.swing.JButton();
        bt_ListaEspera = new javax.swing.JButton();
        bt_ReporteUso = new javax.swing.JButton();
        bt_CerrarSesion = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        mn_Inicio = new javax.swing.JMenu();
        smn_Control = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        smn_Opciones = new javax.swing.JMenuItem();
        smn_CerrarSesion = new javax.swing.JMenuItem();
        mn_Listas = new javax.swing.JMenu();
        smn_ListaEspera = new javax.swing.JMenuItem();
        smn_ListaSancionados = new javax.swing.JMenuItem();
        mn_Reportes = new javax.swing.JMenu();
        smn_ReporteUso = new javax.swing.JMenuItem();
        smn_ReporteEjecutivo = new javax.swing.JMenuItem();
        mn_Ayuda = new javax.swing.JMenu();
        smn_AcercaDe = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("SMEI - Menu Principal");

        jToolBar1.setRollover(true);

        bt_Control.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentacion/imagenes/Agregar.png"))); // NOI18N
        bt_Control.setFocusable(false);
        bt_Control.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        bt_Control.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        bt_Control.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bt_ControlActionPerformed(evt);
            }
        });
        jToolBar1.add(bt_Control);

        bt_ListaEspera.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentacion/imagenes/listaEspera.png"))); // NOI18N
        bt_ListaEspera.setFocusable(false);
        bt_ListaEspera.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        bt_ListaEspera.setMaximumSize(new java.awt.Dimension(35, 35));
        bt_ListaEspera.setMinimumSize(new java.awt.Dimension(35, 35));
        bt_ListaEspera.setPreferredSize(new java.awt.Dimension(35, 35));
        bt_ListaEspera.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        bt_ListaEspera.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bt_ListaEsperaActionPerformed(evt);
            }
        });
        jToolBar1.add(bt_ListaEspera);

        bt_ReporteUso.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentacion/imagenes/reporte.png"))); // NOI18N
        bt_ReporteUso.setFocusable(false);
        bt_ReporteUso.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        bt_ReporteUso.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        bt_ReporteUso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bt_ReporteUsoActionPerformed(evt);
            }
        });
        jToolBar1.add(bt_ReporteUso);

        bt_CerrarSesion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentacion/imagenes/exit.png"))); // NOI18N
        bt_CerrarSesion.setFocusable(false);
        bt_CerrarSesion.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        bt_CerrarSesion.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        bt_CerrarSesion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bt_CerrarSesionActionPerformed(evt);
            }
        });
        jToolBar1.add(bt_CerrarSesion);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Sistema Megalaboratorio Estudiantil de Informática", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(0, 0, 102))); // NOI18N

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentacion/imagenes/VIDA-ESTUDIANTIL (Personalizada) (2).png"))); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(406, 406, 406)
                .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 1634, Short.MAX_VALUE)
                .addGap(440, 440, 440))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(93, 93, 93)
                .addComponent(jLabel2)
                .addContainerGap(344, Short.MAX_VALUE))
        );

        mn_Inicio.setText("Inicio");

        smn_Control.setText("Modulo Control");
        smn_Control.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                smn_ControlActionPerformed(evt);
            }
        });
        mn_Inicio.add(smn_Control);
        mn_Inicio.add(jSeparator1);

        smn_Opciones.setText("Opciones");
        mn_Inicio.add(smn_Opciones);

        smn_CerrarSesion.setText("Cerrar Sesion");
        smn_CerrarSesion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                smn_CerrarSesionActionPerformed(evt);
            }
        });
        mn_Inicio.add(smn_CerrarSesion);

        jMenuBar1.add(mn_Inicio);

        mn_Listas.setText("Listas");

        smn_ListaEspera.setText("Lista de Espera");
        smn_ListaEspera.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                smn_ListaEsperaActionPerformed(evt);
            }
        });
        mn_Listas.add(smn_ListaEspera);

        smn_ListaSancionados.setText("Lista Sancionados");
        smn_ListaSancionados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                smn_ListaSancionadosActionPerformed(evt);
            }
        });
        mn_Listas.add(smn_ListaSancionados);

        jMenuBar1.add(mn_Listas);

        mn_Reportes.setText("Reportes");

        smn_ReporteUso.setText("Reporte de Uso");
        smn_ReporteUso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                smn_ReporteUsoActionPerformed(evt);
            }
        });
        mn_Reportes.add(smn_ReporteUso);

        smn_ReporteEjecutivo.setText("Reporte Ejecutivo");
        smn_ReporteEjecutivo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                smn_ReporteEjecutivoActionPerformed(evt);
            }
        });
        mn_Reportes.add(smn_ReporteEjecutivo);

        jMenuBar1.add(mn_Reportes);

        mn_Ayuda.setText("Ayuda");

        smn_AcercaDe.setText("Acerca de...");
        smn_AcercaDe.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                smn_AcercaDeActionPerformed(evt);
            }
        });
        mn_Ayuda.add(smn_AcercaDe);

        jMenuBar1.add(mn_Ayuda);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel1.getAccessibleContext().setAccessibleName("Bienvenido");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void bt_ControlActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_ControlActionPerformed
        Control c = new Control();
        c.setExtendedState(MAXIMIZED_BOTH);
        c.obtenerGestores(gestorEstudiante, gestorMaquina, gestorAsignacion);
        c.inicializarTabla();
        c.cargarTabla();
        c.setVisible(true);
    }//GEN-LAST:event_bt_ControlActionPerformed

    private void bt_ListaEsperaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_ListaEsperaActionPerformed
        ListaEspera le = new ListaEspera();
        le.setVisible(true);
    }//GEN-LAST:event_bt_ListaEsperaActionPerformed

    private void bt_ReporteUsoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_ReporteUsoActionPerformed
        ReporteUso ru = new ReporteUso();
        ru.setVisible(true);
    }//GEN-LAST:event_bt_ReporteUsoActionPerformed

    private void bt_CerrarSesionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_CerrarSesionActionPerformed
        Login l = new Login();
        this.dispose();
        l.setVisible(true);
    }//GEN-LAST:event_bt_CerrarSesionActionPerformed

    private void smn_AcercaDeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_smn_AcercaDeActionPerformed
        Acerca a = new Acerca();
        a.setVisible(true);
    }//GEN-LAST:event_smn_AcercaDeActionPerformed

    private void smn_ReporteUsoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_smn_ReporteUsoActionPerformed
        ReporteUso ru = new ReporteUso();
        ru.setVisible(true);
    }//GEN-LAST:event_smn_ReporteUsoActionPerformed

    private void smn_ReporteEjecutivoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_smn_ReporteEjecutivoActionPerformed
        ReporteEjecutivo re = new ReporteEjecutivo();
        re.setVisible(true);
    }//GEN-LAST:event_smn_ReporteEjecutivoActionPerformed

    private void smn_ListaEsperaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_smn_ListaEsperaActionPerformed
        ListaEspera le = new ListaEspera();
        le.setVisible(true);
    }//GEN-LAST:event_smn_ListaEsperaActionPerformed

    private void smn_ListaSancionadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_smn_ListaSancionadosActionPerformed
        ListaSancionados ls = new ListaSancionados();
        ls.setVisible(true);
    }//GEN-LAST:event_smn_ListaSancionadosActionPerformed

    private void smn_ControlActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_smn_ControlActionPerformed
        Control c = new Control();
        c.setExtendedState(MAXIMIZED_BOTH);
        c.obtenerGestores(gestorEstudiante, gestorMaquina, gestorAsignacion);
        c.inicializarTabla();
        c.cargarTabla();
        c.setVisible(true);
    }//GEN-LAST:event_smn_ControlActionPerformed

    private void smn_CerrarSesionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_smn_CerrarSesionActionPerformed
        Login l = new Login();
        this.dispose();
        l.setVisible(true);
    }//GEN-LAST:event_smn_CerrarSesionActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bt_CerrarSesion;
    private javax.swing.JButton bt_Control;
    private javax.swing.JButton bt_ListaEspera;
    private javax.swing.JButton bt_ReporteUso;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JMenu mn_Ayuda;
    private javax.swing.JMenu mn_Inicio;
    private javax.swing.JMenu mn_Listas;
    private javax.swing.JMenu mn_Reportes;
    private javax.swing.JMenuItem smn_AcercaDe;
    private javax.swing.JMenuItem smn_CerrarSesion;
    private javax.swing.JMenuItem smn_Control;
    private javax.swing.JMenuItem smn_ListaEspera;
    private javax.swing.JMenuItem smn_ListaSancionados;
    private javax.swing.JMenuItem smn_Opciones;
    private javax.swing.JMenuItem smn_ReporteEjecutivo;
    private javax.swing.JMenuItem smn_ReporteUso;
    // End of variables declaration//GEN-END:variables
}
